package com.labi.designpattern.controller;

import com.labi.designpattern.service.impl.DoctorServiceImpl;
import com.labi.designpattern.service.HumanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class HumanController {

//    @Autowired
//    @Qualifier("teacherServiceImpl")  //方法一
//    @Qualifier("doctorServiceImpl")   //方法一
//    @Resource(type = TeacherServiceImpl.class) //方法二
//    @Resource(type = DoctorServiceImpl.class) //方法二
//   private HumanService humanService;

    //    @Resource(name = "fservice")  //方法3
    @Resource(type = DoctorServiceImpl.class)
    private HumanService humanService;

    @RequestMapping("/name")
    public String name() {
        return humanService.name();
    }



}